bitkeeper revision 1.1159.168.6 (4199134cGy53S7HzqzuO4Ufm3c9ijw)
authormwilli2@equilibrium.research <mwilli2@equilibrium.research>
Mon, 15 Nov 2004 20:36:28 +0000 (20:36 +0000)
committermwilli2@equilibrium.research <mwilli2@equilibrium.research>
Mon, 15 Nov 2004 20:36:28 +0000 (20:36 +0000)
Wait for in the xend init script for Xend to really come
up.  Avoids races with other init scripts.

tools/examples/init.d/xend

index 7037848166c4d35bc24bac96fbd8bc8558126530..39324c7930f5f808baa53a8295055d4aabdee005 100755 (executable)
@@ -7,9 +7,24 @@
 # chkconfig: 2345 98 01
 # description: Starts and stops the Xen control daemon.
 
+# Wait for Xend / Xfrd to be up
+function await_daemons_up
+{
+       i=1
+       rets=10
+       xend status
+       while [ $? -ne 0 -a $i -lt $rets ]; do
+           sleep 1
+           echo -n .
+           i=$(($i + 1))
+           xend status
+       done
+}
+
 case "$1" in
   start)
        xend start
+       await_daemons_up
        ;;
   stop)
        xend stop
@@ -19,6 +34,7 @@ case "$1" in
        ;;
   restart|reload)
        xend restart
+       await_daemons_up
        ;;
   *)
        # do not advertise unreasonable commands that there is no reason